package com.ruoyi.produce.process.parameter.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.produce.process.parameter.domain.ProcessParameter;
import com.ruoyi.produce.process.parameter.service.IProcessParameterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/process/parameter")
@Api(value = "工艺参数模块", tags = "工艺参数接口")
public class ProcessParameterController extends BaseController {
    @Autowired
    private IProcessParameterService processParameterService;

    /**
     * 获取设备工艺参数
     *
     * @param processParameter
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("获取工艺参数记录")
    public TableDataInfo list(@RequestBody ProcessParameter processParameter) {
        startPage();

        List<ProcessParameter> processParameters = processParameterService.selectProcessParameterList(processParameter);

        return getDataTable(processParameters);
    }

    /**
     * 删除设备工艺参数
     *
     * @param processParameter
     * @return
     */
    @PostMapping("/delete")
    @ApiOperation("删除设备工艺参数")
    public AjaxResult delete(@RequestBody ProcessParameter processParameter) {

        return toAjax(processParameterService.deleteProcessParameter(processParameter));
    }
}
